import json

def convert_coin1_constants(data):
  symbol_list = [info['native_symbol'] for info in data]
  quote_currency_list = [info['native_quote'] for info in data]
  base_currency_list = [info['native_base'] for info in data]
  currency_list = base_currency_list + quote_currency_list
  contract_type_list = [info['native_symbol'].split('.')[-1] for info in data]
  res = {
      'symbol_list': list(set(symbol_list)),
      'base_currency_list': list(set(base_currency_list)),
      'quote_currency_list': list(set(quote_currency_list)),
      'currency_list': list(set(currency_list)),
      'contract_type_list': list(set(contract_type_list))
  }
  return res

pi_file = 'data/coin2/product_info/Futures.Prex.v1.json'
with open(pi_file) as f:
  static_constants = convert_coin1_constants(json.load(f)['product_infos'])

dynamic_constants = {}
# TODO(chensili): add dynamic part

base_currency_list = list(set(
    static_constants.get('base_currency_list', []) +
    dynamic_constants.get('base_currency_list', [])))
quote_currency_list = list(set(
    static_constants.get('quote_currency_list', []) +
    dynamic_constants.get('quote_currency_list', [])))
currency_list = list(set(
    static_constants.get('currency_list', []) +
    dynamic_constants.get('currency_list', [])))
contract_type_list = list(set(
    static_constants.get('contract_type_list', []) +
    dynamic_constants.get('contract_type_list', [])))
